<template>
  <div class="anytime-service-my">
    <c-title text="随叫随到"></c-title>
    <div class="head">
      <van-image round width="3.5rem" height="3.5rem" :src="member.avatar_image" />
      <span class="nick-name">{{ member.nickname }}</span>
    </div>
    <!-- 角色申请 -->
    <div class="box" v-if="is_publish == 0 || is_shifu == 0  || is_enterprise==0">
      <p class="title">角色申请</p>
      <div class="flex">
        <router-link v-if="is_publish !== 1" tag="div" :to="fun.getUrl('anytimeRoleApply', { apply_for_type: 1 })"
          class="flex-column">
          <van-image width="1.3438rem" height="1.3438rem"
            src="https://mini-app-img-1251768088.cos.ap-guangzhou.myqcloud.com/plugin/anytime_service/icon_apply.png" />
          <span class="fz-24">发布者申请</span>
        </router-link>
        <router-link v-if="is_shifu !== 1" tag="div" :to="fun.getUrl('anytimeRoleApply', { apply_for_type: 2 })"
          class="flex-column ">
          <van-image width="1.3438rem" height="1.3438rem"
            src="https://mini-app-img-1251768088.cos.ap-guangzhou.myqcloud.com/plugin/anytime_service/icon_worker.png" />
          <span class="fz-24">技能师傅申请</span>
        </router-link>
        <router-link v-if="is_enterprise !== 1" class="flex-column" tag="div"
          :to="fun.getUrl('anytimeRoleApply', { apply_for_type: 3 })">
          <van-image width="1.3438rem" height="1.3438rem" src="https://mini-app-img-1251768088.cos.ap-guangzhou.myqcloud.com/plugin/anytime_service/icon_company.png" />
          <span class="fz-24">企业申请</span>
        </router-link>
      </div>
    </div>
    <!-- 发布者管理 -->
    <div class="box" v-if="is_publish">
      <p class="title">发布者管理</p>
      <div class="flex">
        <router-link tag="div" :to="fun.getUrl('anytimeRoleApply', { apply_for_type:1 })" class="flex-column">
          <van-image width="1.3438rem" height="1.3438rem"
            src="https://mini-app-img-1251768088.cos.ap-guangzhou.myqcloud.com/plugin/anytime_service/icon_admin.png" />
          <span class="fz-24">发布者信息</span>
        </router-link>
        <router-link tag="div" :to="fun.getUrl('anytimeDemand', { type: 1 })" class="flex-column">
          <van-image width="1.3438rem" height="1.3438rem"
            src="https://mini-app-img-1251768088.cos.ap-guangzhou.myqcloud.com/plugin/anytime_service/icon_publish.png" />
          <span class="fz-24">发布个人需求</span>
        </router-link>
        <router-link tag="div" :to="fun.getUrl('anytimeDemandManage')" class="flex-column">
          <van-image width="1.3438rem" height="1.3438rem"
            src="https://mini-app-img-1251768088.cos.ap-guangzhou.myqcloud.com/plugin/anytime_service/icon_demand.png" />
          <span class="fz-24">需求管理</span>
        </router-link>
      </div>
    </div>
    <!-- 技能师傅管理 -->
    <div class="box" v-if="is_shifu">
      <p class="title">技能师傅管理</p>
      <div class="flex">
        <router-link tag="div" :to="fun.getUrl('anytimeRoleApply', { apply_for_type:2 })" class="flex-column">
          <van-image width="1.3438rem" height="1.3438rem"
            src="https://mini-app-img-1251768088.cos.ap-guangzhou.myqcloud.com/plugin/anytime_service/icon_information.png" />
          <span class="fz-24">技能师傅信息</span>
        </router-link>
        <router-link tag="div" :to="fun.getUrl('anytimeSkillMasterManage')" class="flex-column ">
          <van-image width="1.3438rem" height="1.3438rem"
            src="https://mini-app-img-1251768088.cos.ap-guangzhou.myqcloud.com/plugin/anytime_service/icon_skill.png" />
          <span class="fz-24">技能管理</span>
        </router-link>
        <router-link tag="div" :to="fun.getUrl('anytimeSkillMasterOrder')" class="flex-column">
          <van-image width="1.3438rem" height="1.3438rem"
            src="https://mini-app-img-1251768088.cos.ap-guangzhou.myqcloud.com/plugin/anytime_service/icon_order.png" />
          <span class="fz-24">订单管理</span>
        </router-link>
        <router-link tag="div" :to="fun.getUrl('anytimeRecord')" class="flex-column">
          <i class="iconfont icon-icon_award" style="width: 1.3438rem; height: 1.3438rem; font-size: 23px;"></i>
          <span class="fz-24">奖励入口</span>
        </router-link>
      </div>
    </div>
    <!-- 企业管理 -->
    <div class="box" v-if="is_enterprise">
      <p class="title">企业管理</p>
      <div class="flex">
        <router-link class="flex-column" :to="fun.getUrl('anyEnterpriseApplication')">
          <van-image width="1.3438rem" height="1.3438rem"
            src="https://mini-app-img-1251768088.cos.ap-guangzhou.myqcloud.com/plugin/anytime_service/icon_company.png" />
          <span class="fz-24">企业信息</span>
        </router-link>
        <router-link class="flex-column" :to="fun.getUrl('anyDemandPublish')">
          <van-image width="1.3438rem" height="1.3438rem"
            src="https://mini-app-img-1251768088.cos.ap-guangzhou.myqcloud.com/plugin/anytime_service/icon_demand1.png" />
          <span class="fz-24">发布企业需求</span>
        </router-link>
        <router-link class="flex-column" :to="fun.getUrl('anyDemandManagement')">
          <van-image width="1.3438rem" height="1.3438rem"
            src="https://mini-app-img-1251768088.cos.ap-guangzhou.myqcloud.com/plugin/anytime_service/icon_demand.png" />
          <span class="fz-24">需求管理</span>
        </router-link>
        <router-link class="flex-column" :to="fun.getUrl('anyEnterprisePackage')">
          <van-image width="1.3438rem" height="1.3438rem"
            src="https://mini-app-img-1251768088.cos.ap-guangzhou.myqcloud.com/plugin/anytime_service/icon_combinatione.png" />
          <span class="fz-24">企业套餐</span>
        </router-link>
      </div>
    </div>
    <!-- 区域代理管理 -->
    <div class="box" v-if="is_area_agent">
      <p class="title">区域代理管理</p>
      <div class="flex">
        <router-link tag="div" :to="fun.getUrl('anytimeArea')" class="flex-column">
          <van-image width="1.3438rem" height="1.3438rem"
            src="https://mini-app-img-1251768088.cos.ap-guangzhou.myqcloud.com/plugin/anytime_service/icon_manage.png" />
          <span class="fz-24">技能师傅管理</span>
        </router-link>
        <router-link tag="div" :to="fun.getUrl('anytimeAreaOrder')" class="flex-column">
          <van-image width="1.3438rem" height="1.3438rem"
            src="https://mini-app-img-1251768088.cos.ap-guangzhou.myqcloud.com/plugin/anytime_service/manage_order.png" />
          <span class="fz-24">技能师傅订单</span>
        </router-link>
      </div>
    </div>
    <!-- 订单管理 -->
    <div class="box">
      <p class="title">订单管理</p>
      <div class="flex">
        <router-link tag="div" :to="fun.getUrl('anyOrderIndex')" class="flex-column">
          <i class="iconfont icon-icon_dingdan_11" style="font-size: 1.3rem;"></i>
          <!-- <van-image width="1.3438rem" height="1.3438rem"
            src="https://mini-app-img-1251768088.cos.ap-guangzhou.myqcloud.com/plugin/anytime_service/icon_dingdan_1.png" /> -->
          <span class="fz-24">订单</span>
        </router-link>
      </div>
    </div>

    <bottomBar tab_type="我的"></bottomBar>
  </div>
</template>

<script>
import { Image as VanImage } from 'vant';
import bottomBar from "../home/components/bottom_bar.vue"
export default {
  data() {
    return {
      authtrue: 1,//角色申请
      is_publish: 1,//发布者：1是0否
      is_shifu: 0,//师傅：1是0否
      is_enterprise: 0,//企业：1是0否
      is_area_agent: 1,//是否区域管理员：1是0否
      member: {}
    };
  },
  activated() {
    this.getData()
  },
  methods: {
    getData() {
      $http.get("plugin.be-within-call.frontend.manage.my", { validate_page: 1 }, '').then(res => {
        if (res.result) {
          let data = res.data;
          this.member = data.member;
          this.is_publish = data.is_publish;
          this.is_shifu = data.is_shifu;
          this.is_enterprise = data.is_enterprise;
          this.is_area_agent = data.is_area_agent;
        } else {
          this.$toast(res.msg)
        }
      })
    },
  },
  components: { bottomBar, VanImage },
};
</script>

<style scoped lang="scss">
.anytime-service-my {
  padding-bottom: 5.125rem;

  .fz-24 {
    font-size: 0.85rem;
    color: #999;
    margin-top: 0.4063rem;
  }

  .flex {
    display: flex;
  }

  .box {
    background: #fff;
    padding: 0.9375rem 0.75rem;
    margin-bottom: 0.5rem;
  }

  .title {
    font-size: 1.1rem;
    text-align: left;
    margin-bottom: 1.5rem;
  }

  .nick-name {
    margin-left: 0.625rem;
    color: #fff;
    font-size: 1.1rem;
    font-weight: bold;
  }

  .flex-column {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 25%;
  }

  .head {
    padding: 1.5625rem 1rem 1.4063rem;
    display: flex;
    align-items: center;
    background: linear-gradient(139deg, #4978f8 0%, #3737ff 100%);
  }
}
</style>
